﻿using My.Domain.Issues;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;

namespace My.TestBase
{
    public class TestDataSeedContributor : IDataSeedContributor, ITransientDependency
    {
        private readonly IIssueRepository _issueRepository;

        public TestDataSeedContributor(IIssueRepository issueRepository)
        {
            _issueRepository = issueRepository;
        }

        public async Task SeedAsync(DataSeedContext context)
        {
            /* Seed additional test data... */
            await _issueRepository.InsertAsync(
                new Issue(
                id: TestData.Issue1Id,
                repositoryId: Guid.NewGuid(),
                title: "问题1",
                text: "内容1",
                assignedUserId: TestData.User1Id
                ));

            await _issueRepository.InsertAsync(
                new Issue(
                id: TestData.Issue2Id,
                repositoryId: Guid.NewGuid(),
                title: "问题2",
                text: "内容2",
                assignedUserId: TestData.User2Id
                ));
        }
    }
}
